import java.util.Hashtable;

public class PC2RobotTest {
	
	private static Hashtable<String, String> mac2Name;
	
	public static void main(String[] args) throws InterruptedException {
		
		mac2Name = new Hashtable<String, String>();
		mac2Name.put("btspp://00:16:53:07:1C:A0", "JAN");
		
		PCBluetooth currentConn;
		
		BTConnections connections = new BTConnections();

		DataMessageListener dml = new DataMessageListener() {
			public void messageReceived(Object sender, DataMessage message) {
				if (sender instanceof PCBluetooth) {}
				System.out.println(mac2Name.get(((PCBluetooth)sender).getDeviceURL())+ ": " +message.getText());
			}
		};
		
		DataMessage message = new DataMessage((byte)3, "Here is a message");
		System.out.println("message is valid? : " + message.isValid());
		
		connections.newConn("JAN", new PCBluetooth("btspp://00:16:53:07:1C:A0", dml));
		currentConn = connections.getConn("JAN");
		
		Thread.sleep(5000);
		
		
		//Thread.sleep(10000);
		while (true) {
			Thread.sleep(5000);
			currentConn.sendMessage(message);
		}
		//currentConn.close();
	}
	
		
}
